package com.xinqing.test.LetCode;

import java.util.HashSet;

/**
 * @Author:CHQ
 * @Date:2021/7/20 16:39
 * @Description
 */
public class DeleteDuplicates {
    public static void main(String args[]){
        HashSet<Integer> set =new HashSet<>();
        ListNode head=new ListNode(1);
        ListNode head2=new ListNode(2);
        ListNode head3=new ListNode(2);
        ListNode head4=new ListNode(3);
        head.next=head2;
        head2.next=head3;
        head3.next=head4;

        System.out.print(test(head).toString());
    }
    public static ListNode test(ListNode head){
        ListNode cur=head;
        while(cur.next!=null){
            if(cur.val==cur.next.val){
                cur.next=cur.next.next;
            }else{
                cur=cur.next;
            }
        }
        return head;
    }
}
